package com.example.controller;


import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.example.entity.RestContext;
import com.example.entity.TUserVue;
import com.example.service.TUserVueService;
import io.swagger.models.auth.In;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author 4977332@qq.com
 * @since 2021-06-10
 */
@RestController
@RequestMapping("/tUserVue")
@CrossOrigin
public class TUserVueController {
    @Autowired
    private TUserVueService tUserVueService;

    @PostMapping("/login")
    public RestContext login(String username, String password){
        System.out.println(username);
        System.out.println(password);
        RestContext restContext =new RestContext();
        QueryWrapper<TUserVue> queryWrapper=new QueryWrapper<>();
        queryWrapper.eq("username",username);
        queryWrapper.eq("password",password);
        List<TUserVue> list = tUserVueService.list(queryWrapper);
        if (list!=null){
            restContext.setCode(200);
            restContext.setData(list);
        }else {
            restContext.setCode(404);
        }

        System.out.println("朱大吊");
        return restContext;
    }
}

